-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(starknet_l1_provider): add scraper #2853
Conversation
giladchase
commented
Dec 20, 2024
•
edited
Loading
edited
- base layer constant file will hold the identifiers of Starknet Events.
- fetch_events will get events from base layer and send to provider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @giladchase and @matan-starkware)
crates/starknet_l1_provider/src/l1_scraper.rs
line 55 at r1 (raw file):
self.fetch_events().await?; } }
Is this the canonical run
implementation in our node?
Code quote:
async fn _run(&mut self) -> L1ScraperResult<(), B> {
loop {
sleep(self.config.polling_interval).await;
// TODO: retry.
self.fetch_events().await?;
}
}
crates/starknet_l1_provider/src/l1_scraper.rs
line 60 at r1 (raw file):
#[derive(Clone, Debug, Serialize, Deserialize, Validate, PartialEq)] pub struct L1ScraperConfig { // TODO: make this config into trait.
WDYM? Why?
Code quote:
// TODO: make this config into trait.
f887cbb
to
83be466
Compare
573a0b3
to
75d3714
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @giladchase and @matan-starkware)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 7 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @giladchase)
-- commits
line 4 at r2:
We don't want these to be configurable?
Code quote:
- base layer constant file will hold the identifiers of Starknet Events.
crates/starknet_l1_provider/src/l1_scraper_tests.rs
line 0 at r2 (raw file):
Why add an empty file?
83be466
to
1c38ffc
Compare
75d3714
to
717a4de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 of 8 files reviewed, 3 unresolved discussions (waiting on @elintul and @matan-starkware)
Previously, matan-starkware wrote…
We don't want these to be configurable?
I might be misunderstanding you, but AFAIK event identifiers (in Ethereum) are fixed, they are always:
keccak(<signature_of_event>)
.
The identifier will only change if the signature changes, and this updates the const during compilation time (since the consts are generated from sol!
).
crates/starknet_l1_provider/src/l1_scraper.rs
line 55 at r1 (raw file):
Previously, elintul (Elin) wrote…
Is this the canonical
run
implementation in our node?
I haven't found any similar run
use-case in our code. We currently only have loop-and-select! style run
s, without any loop-do-sleep-awake
loops.
With that said, this is a very basic implementation, I'll extend it soon once the pressure's off, unless you have stuff in mind now?
crates/starknet_l1_provider/src/l1_scraper.rs
line 60 at r1 (raw file):
Previously, elintul (Elin) wrote…
WDYM? Why?
Seems to be refactoring leftovers, doesn't make sense here, removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @giladchase and @matan-starkware)
crates/starknet_l1_provider/src/l1_scraper.rs
line 55 at r1 (raw file):
Previously, giladchase wrote…
I haven't found any similar
run
use-case in our code. We currently only have loop-and-select! stylerun
s, without anyloop-do-sleep-awake
loops.With that said, this is a very basic implementation, I'll extend it soon once the pressure's off, unless you have stuff in mind now?
Nope, sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @giladchase and @matan-starkware)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @matan-starkware)
258b7d5
to
5d94a73
Compare
717a4de
to
2710496
Compare
428f5ed
to
500ead9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @matan-starkware)
500ead9
to
1e1f9a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 7 files at r1, 2 of 3 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @giladchase)
Previously, giladchase wrote…
I might be misunderstanding you, but AFAIK event identifiers (in Ethereum) are fixed, they are always:
keccak(<signature_of_event>)
.
The identifier will only change if the signature changes, and this updates the const during compilation time (since the consts are generated fromsol!
).
I understand a given event has a fixed identifier, I was wondering if the set of identifiers we want to track may change over time or with tests.
Ok thanks for explaining about them being generated by sol!
. I see in your later PR pub const LOG_MESSAGE_TO_L2_EVENT_IDENTIFIER: &str = Starknet::LogMessageToL2::SIGNATURE;
So my idea was infeasible
6ef9323
to
d46875d
Compare
2710496
to
e97dcf6
Compare
dbf8284
to
f222103
Compare
- base layer constant file will hold the identifiers of Starknet Events. - fetch_events will get events from base layer and send to provider
f222103
to
f2bac0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 of 8 files reviewed, all discussions resolved (waiting on @elintul and @matan-starkware)
I understand a given event has a fixed identifier, I was wondering if the set of identifiers we want to track may change over time or with tests.
For sure, that is covered by the tracked_event_identifiers
field which is passed to the provider in its constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 7 files at r1, 1 of 2 files at r2, 1 of 3 files at r3, 3 of 3 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @giladchase)